package com.supermap.application.configuration;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @name 定义数据源配置类
 *          可配置多个数据源
 * @author sun'f
 * @date 2019/02/28
 *
 */
//@Configuration
public class DataSourceConfiguration {

   /* @Bean(name = "primaryDataSource")
    @Qualifier("primaryDataSource")
    @Primary
    @ConfigurationProperties(prefix="spring.datasource.primary")
    public DataSource primaryDataSource() {
        System.out.println("primary db build");
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "industryDataSource")
    @Qualifier("industryDataSource")
    @ConfigurationProperties(prefix="spring.datasource.industryDataSource")
    public DataSource industryDataSource() {
        System.out.println("industry db build");
        return DataSourceBuilder.create().build();
    }*/
}